package georah.map
{

	import flash.events.Event;

	import georah.carto.geometries.OGCPoint;

	/**
	 *
	 * @author yuanm
	 */
	public class MapEvent extends Event
	{
		public static const CAMERA_CHANGE:String="mapCameraChange";

		public static const CHANGE:String="mapChange";

		public static const READY:String="mapReady";

		public static const SIZE_CHANGE:String="mapSizeChange";

		public function MapEvent(type:String, map_:MapValue, lastMap_:MapValue, bubbles:Boolean=false, cancelable:Boolean=false)
		{
			super(type, bubbles, cancelable);
			_map=map_;
			_lastMap=lastMap_;
		}

		private var _lastMap:MapValue=null;

		private var _map:MapValue=null;

		public final function get lastMap():MapValue
		{
			return _lastMap;
		}

		public final function get map():MapValue
		{
			return _map;
		}

		public final function get pan():OGCPoint
		{
			return new OGCPoint(map.SRID, map.centerX - lastMap.centerX, map.centerY - lastMap.centerY);
		}

		public final function get zoom():Number
		{
			return map.scale / lastMap.scale;
		}

	}
}
